package server.utils;

import java.io.IOException;
import java.util.Enumeration;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpSession;



import org.springframework.util.StringUtils;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;


public class GetSessionWrapper extends HttpServletRequestWrapper {
    private String sessionId=null;
    public GetSessionWrapper(HttpServletRequest request) {
        super(request);
    }
    public GetSessionWrapper(HttpServletRequest request,String sessionId) {
        super(request);
        this.setSessionId(sessionId);

    }


    @Override
    public HttpSession getSession() {
        HttpSession httpSession=super.getSession();
        //id-->sessionId;
        String id="123456";
        String json=CooKieUtil.generateUUID();
        if(StringUtils.isEmpty(json)){
            return httpSession;
        }
        // 读取JSON数据

        return httpSession;
    }

    @Override
    public HttpSession getSession(boolean create) {
        HttpSession httpSession=super.getSession(create);
        return httpSession;
    }
    public static void main(String[] args) {
        String sessionId="123456";
//        String json=MemcachedUtil.getValue(sessionId);
//        System.out.println(json);
    }
    public String getSessionId() {
        return sessionId;
    }
    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }
}
